home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 428_02 / pictor.h < prev    next >
C/C++ Source or Header  |  1994-03-13  |  8KB  |  307 lines

  1. /*
  2. ** pictor.h
  3. **
  4. ** Pictor, Version 1.51, Copyright (c) 1992-94 SoftCircuits
  5. ** Redistributed by permission.
  6. */
  7.  
  8. #ifndef PICTOR_H
  9. #define PICTOR_H
  10.  
  11. /* constants */
  12. #define TRUE            0x01
  13. #define FALSE           0x00
  14.  
  15. #define COLOR_SEG       0xB800
  16. #define MONO_SEG        0xB000
  17. #define CGA_STATUS_PORT 0x03DA
  18.  
  19. #define BLACK           0x00
  20. #define BLUE            0x01
  21. #define GREEN           0x02
  22. #define CYAN            0x03
  23. #define RED             0x04
  24. #define MAGENTA         0x05
  25. #define YELLOW          0x06
  26. #define WHITE           0x07
  27. #define BOLD            0x08
  28. #define BLINKING        0x10
  29.  
  30. /* keyboard constants */
  31. #define ESCAPE_KEY      0x011B
  32. #define TAB_KEY         0x0F09
  33. #define SHIFTTAB_KEY    0x0F00
  34. #define ENTER_KEY       0x1C0D
  35. #define SPACE_BAR       0x3920
  36. #define BACKSPACE_KEY   0x0E08
  37. #define INSERT_KEY      0x5200
  38. #define DELETE_KEY      0x5300
  39. #define HOME_KEY        0x4700
  40. #define UP_KEY          0x4800
  41. #define PGUP_KEY        0x4900
  42. #define PGDN_KEY        0x5100
  43. #define LEFT_KEY        0x4B00
  44. #define RIGHT_KEY       0x4D00
  45. #define END_KEY         0x4F00
  46. #define DOWN_KEY        0x5000
  47.  
  48. #define F1_KEY          0x3B00
  49. #define F2_KEY          0x3C00
  50. #define F3_KEY          0x3D00
  51. #define F4_KEY          0x3E00
  52. #define F5_KEY          0x3F00
  53. #define F6_KEY          0x4000
  54. #define F7_KEY          0x4100
  55. #define F8_KEY          0x4200
  56. #define F9_KEY          0x4300
  57. #define F10_KEY         0x4400
  58.  
  59. #define ALT_A           0x1E00
  60. #define ALT_B           0x3000
  61. #define ALT_C           0x2E00
  62. #define ALT_D           0x2000
  63. #define ALT_E           0x1200
  64. #define ALT_F           0x2100
  65. #define ALT_G           0x2200
  66. #define ALT_H           0x2300
  67. #define ALT_I           0x1700
  68. #define ALT_J           0x2400
  69. #define ALT_K           0x2500
  70. #define ALT_L           0x2600
  71. #define ALT_M           0x3200
  72. #define ALT_N           0x3100
  73. #define ALT_O           0x1800
  74. #define ALT_P           0x1900
  75. #define ALT_Q           0x1000
  76. #define ALT_R           0x1300
  77. #define ALT_S           0x1F00
  78. #define ALT_T           0x1400
  79. #define ALT_U           0x1600
  80. #define ALT_V           0x2F00
  81. #define ALT_W           0x1100
  82. #define ALT_X           0x2D00
  83. #define ALT_Y           0x1500
  84. #define ALT_Z           0x2C00
  85.  
  86. #define ALT_0           0x8100
  87. #define ALT_1           0x7800
  88. #define ALT_2           0x7900
  89. #define ALT_3           0x7A00
  90. #define ALT_4           0x7B00
  91. #define ALT_5           0x7C00
  92. #define ALT_6           0x7D00
  93. #define ALT_7           0x7E00
  94. #define ALT_8           0x7F00
  95. #define ALT_9           0x8000
  96.  
  97. /* messagebox arguments */
  98. #define MB_OK           0
  99. #define MB_OKCANCEL     1
  100. #define MB_RETRYCANCEL  2
  101. #define MB_RETRYABORT   3
  102. #define MB_YESNO        4
  103. #define MB_YESNOCANCEL  5
  104.  
  105. /* wopen arguments */
  106. #define WO_SHADOW       0x0001
  107. #define WO_TEXTCURSOR   0x0002
  108. /* #define WO_NOFRAME      0x0004 */
  109. #define WO_STATICMEM    0x0008
  110. #define WO_TEXTWRAP     0x0010
  111.  
  112. /* wpane arguments */
  113. #define WP_VERTICAL     0x0001
  114. #define WP_HORIZONTAL   0x0002
  115.  
  116. /* MAINMENU and SUBMENU  contants */
  117. #define SUBMENU_DIVIDER {(char *)-1,(char *)-1,NULL,(void (*)(void))0}
  118. #define END_SUBMENU     {NULL,NULL,NULL,(void (*)(void))0}
  119. #define END_MAINMENU    {NULL,NULL,NULL,NULL}
  120.  
  121.  
  122. /* data structures */
  123. typedef struct _SUBMENU {
  124.     char *item;
  125.     char *description;
  126.     char *helptopic;
  127.     void (*function)(void);
  128. } SUBMENU;
  129.  
  130. typedef struct _MAINMENU {
  131.     char *item;
  132.     char *description;
  133.     char *helptopic;
  134.     SUBMENU *submenu;
  135. } MAINMENU;
  136.  
  137. typedef struct _PANESTRUCT {
  138.     int top;
  139.     int left;
  140.     int height;
  141.     int width;
  142.     int row,column;
  143.     int color;
  144. } PANESTRUCT;
  145.  
  146. typedef struct _WINDOW {
  147.     struct _WINDOW *next;
  148.     int oldcurspos;
  149.     int oldcurstype;
  150.     int top;
  151.     int left;
  152.     int height;
  153.     int width;
  154.     int style;
  155.     int color;
  156.     int *buffer;
  157.     int numpanes;
  158.     int currpane;
  159.     PANESTRUCT panes[1];
  160. } WINDOW;
  161.  
  162. typedef struct _COLORSTRUCT {
  163.     int normal;
  164.     int boldnormal;
  165.     int select;
  166.     int boldselect;
  167. } COLORSTRUCT;
  168.  
  169. typedef struct _VIDEOSTRUCT {
  170.     unsigned segment;
  171.     int snowcheck;
  172.     int rows;
  173.     int columns;
  174.     int mode;
  175.     int page;
  176.     int colorsupport;
  177. } VIDEOSTRUCT;
  178.  
  179. typedef struct _MEDITSTRUCT {
  180.     char *prompt;
  181.     char *buffer;
  182.     int maxlen;
  183. } MEDITSTRUCT;
  184.  
  185.  
  186. extern int _PL_segment,_PL_offset;
  187. extern int _PL_color,_PL_snowcheck;
  188. extern int _PL_rows,_PL_columns;
  189. extern int _PL_mode,_PL_page;
  190. extern int _PL_colorsupport;
  191. extern int _PL_menurow,_PL_statusrow;
  192. extern int _PL_shadowcolor;
  193. extern int _PL_pushedkey,_PL_escape;
  194. extern int _PL_errorbeep;
  195. extern int (*_PL_helpfunc)();
  196. extern char *_PL_helpcontext;
  197. extern WINDOW *_PL_winhead;
  198.  
  199. #define _CURR_WPANE (_PL_winhead->panes[_PL_winhead->currpane])
  200.  
  201. /* macros */
  202. #define center(_a,_b) ((((_b) - (_a)) / 2) + 1)
  203. #define cleareol() \
  204.     { if(getvcol() <= _PL_columns) vrepc(' ',(_PL_columns - getvcol()) + 1); }
  205. #define escpressed() (_PL_escape)
  206. #define foreback(_f,_b) \
  207.     (((_f) & 0x0F) | (((_f) & 0x10) << 3) | (((_b) & 0x07) << 4))
  208. #define getcurscol() (getcurs() & 0xFF)
  209. #define getcursrow() ((getcurs() >> 8) & 0xFF)
  210. #define getvcol() (((_PL_offset / 2) % _PL_columns) + 1)
  211. #define getvrow() (((_PL_offset / 2) / _PL_columns) + 1)
  212. #define getwcols() (_CURR_WPANE.width - 2)
  213. #define getwrows() (_CURR_WPANE.height - 2)
  214. #define helpgetcontext() (_PL_helpcontext)
  215. #define helpsetcontext(_s) (_PL_helpcontext = _s)
  216. #define kbdpush(_x) (_PL_pushedkey = _x)
  217. #define seterrorbeep(_x) (_PL_errorbeep = _x)
  218. #define setdoubleframe() \
  219.     setframe('\xCD','\xBA','\xC9','\xBB','\xC8','\xBC')
  220. #define setsingleframe() \
  221.     setframe('\xC4','\xB3','\xDA','\xBF','\xC0','\xD9')
  222. #define setvpos(_r,_c) \
  223.     (_PL_offset = (((((_r) - 1) * _PL_columns) + ((_c) - 1)) * 2))
  224. #define snowcheckoff() (_PL_snowcheck = FALSE)
  225. #define synccurs() setcurs(getvrow(),getvcol())
  226. #define syncvpos() setvpos(getcursrow(),getcurscol())
  227. #define vcolor(_c) (_PL_color = _c)
  228.  
  229.  
  230. /* function prototypes */
  231. void beep(void);
  232. void clrstatus(void);
  233. void cls(void);
  234. int editbox(char *,char *,int,char *,COLORSTRUCT *);
  235. void frame(int,int,int,int);
  236. int getaltkey(int);
  237. int getcurs(void);
  238. int getcurstype(void);
  239. int gethotkey(char *);
  240. void getscrn(int *,int,int,int,int);
  241. void getvconfig(VIDEOSTRUCT *);
  242. int getwcol(void);
  243. int getwrow(void);
  244. void helpclose(void);
  245. void helpopen(char *,COLORSTRUCT *,COLORSTRUCT *);
  246. int helprun(char *);
  247. int hookints(COLORSTRUCT *);
  248. void hputs(char *,int);
  249. int hstrlen(char *);
  250. void initstatus(int,int);
  251. void initvideo(void);
  252. int installclock(int,int,int);
  253. int kbdedit(char *,int,int,int,int,COLORSTRUCT *);
  254. int kbdflush(void);
  255. int kbdread(void);
  256. int kbdready(void);
  257. int kbdshift(void);
  258. int listbox(char **,int,int *,char *,COLORSTRUCT *);
  259. int messagebox(char *,char *,int,COLORSTRUCT *);
  260. int multiedit(MEDITSTRUCT *,int,char *,COLORSTRUCT *);
  261. void pause(int);
  262. char *pickfile(char *,char *,COLORSTRUCT *);
  263. int popcurs(void);
  264. int popstatus(void);
  265. int prnputc(char);
  266. int prnputs(char *);
  267. int prnwrite(char *,int);
  268. int pushcurs(void);
  269. int pushstatus(void);
  270. void putscrn(int *,int,int,int,int);
  271. int removeclock(void);
  272. int runmenu(MAINMENU *,COLORSTRUCT *,COLORSTRUCT *);
  273. void scroll(int,int,int,int,int);
  274. void setcurs(int,int);
  275. void setcurstype(int);
  276. void setframe(char,char,char,char,char,char);
  277. int setwpane(int);
  278. void setwpos(int,int);
  279. void showcurs(int);
  280. void showmenu(MAINMENU *,COLORSTRUCT *,int);
  281. void statusbar(char *);
  282. void tone(int,int);
  283. int unhookints(void);
  284. int vgetca(void);
  285. void vputa(int);
  286. void vputc(char);
  287. void vputca(int);
  288. void vputs(char *);
  289. void vrepa(int,int);
  290. void vrepc(char,int);
  291. void wclear(void);
  292. void wcleareol(void);
  293. void wclose(void);
  294. void wcloseall(void);
  295. void wcolor(int);
  296. int wopen(int,int,int,int,int,int);
  297. int wpane(int,int);
  298. void wputc(char);
  299. void wputs(char *);
  300. void wrepa(int,int);
  301. void wrepc(char,int);
  302. void wsynccurs(void);
  303. void wtitle(char *);
  304. void xprintf(void (*)(),char *,...);
  305.  
  306. #endif
  307.